<?php

namespace App\Models\Factory;

use App\Models\AbsModelFactory;
use App\Models\Orm\AwAuditRecord;


/**
 * 合作方审核记录申请记录表工厂方法
 * Class AwAuditRecordFactory
 * @package App\Models\Factory
 */
class AwAuditRecordFactory extends AbsModelFactory
{
    /**
     * 获取用户正在审核的一条记录
     * @param $user_id
     * @param $action
     * @param int $type
     * @return mixed
     */
    public static function getUserInitRecord($user_id, $action, $type = AwAuditRecord::TYPE_EDIT)
    {
        return AwAuditRecord::where('user_id', $user_id)
            ->where('action', $action)
            ->where('type', $type)
            ->where('status', AwAuditRecord::STATUS_INIT)
            ->first();
    }
}
